<!-- BEGIN: Subheader -->
<div class="m-subheader">
    <div class="d-flex align-items-center">
        <div class="mr-auto">
            <h3 class="m-subheader__title">
                业务表管理
            </h3>
            <ul class="m-subheader__breadcrumbs m-nav m-nav--inline">
                <li class="m-nav__item m-nav__item--home">
                    <a href="#" class="m-nav__link m-nav__link--icon">
                        <i class="m-nav__link-icon la la-home"></i>
                    </a>
                </li>
            </ul>
        </div>
        <div>
        </div>
    </div>
</div>
<!-- END: Subheader -->


<div class="m-content">
    <!--begin::Portlet-->
    <div class="m-portlet">
        <div class="m-portlet__head">
            <div class="m-portlet__head-caption">
                <div class="m-portlet__head-title">
                    <h3 class="m-portlet__head-text">
                        添加业务表
                        <small>
                            数据表单
                        </small>
                    </h3>
                </div>
            </div>
            <div class="m-portlet__head-tools">
                <a href="#/gen/genTable/list" title="业务表列表" class="m-portlet__nav-link btn list btn-lg btn-outline-primary m-btn m-btn--outline-1x m-btn--air m-btn--icon m-btn--icon-only m-btn--pill ">
                    <i class="la la-th-list"></i>
                </a>
            </div>
        </div>
        <!--begin::Form-->
        <form class="m-form m-form--label-align-right form-validation" action="{{ctx}}/gen/genTable/" method="post" id="genTable-save-form">
            <input type="hidden" name="id" value="{{genTable.id}}" />
            <div class="m-portlet__body">
                <div class="m-form__content bootstrap-alerts">

                </div>
                <div class="m-section">
                    <span class="m-section__sub">
                        基本信息
                    </span>
                    <div class="m-section__content">
                        <div class="form-group m-form__group row">
                            <label class="col-form-label col-lg-3 col-sm-12">
                                名称 *
                            </label>
                            <div class="col-lg-4 col-md-9 col-sm-12">
                                <input type="text" name="name" value="{{genTable.name}}"
                                       maxlength="64" class="form-control required"/>
                            </div>
                        </div>
                        <div class="form-group m-form__group row">
                            <label class="col-form-label col-lg-3 col-sm-12">
                                说明 *
                            </label>
                            <div class="col-lg-4 col-md-9 col-sm-12">
                                <input type="text" name="comments" value="{{genTable.comments}}"
                                       maxlength="64" class="form-control required"/>
                            </div>
                        </div>
                        <div class="form-group m-form__group row">
                            <label class="col-form-label col-lg-3 col-sm-12">
                                类名 *
                            </label>
                            <div class="col-lg-4 col-md-9 col-sm-12">
                                <input type="text" name="className" value="{{genTable.className}}"
                                       maxlength="64" class="form-control required"/>
                            </div>
                        </div>
                        <div class="form-group m-form__group row">
                            <label class="col-form-label col-lg-3 col-sm-12">
                                父表表名
                            </label>
                            <div class="col-lg-3 col-md-9 col-sm-12">
                                <alb-form name="parentTable" cssClass="" [dataLiveSearch]="true" value="{{genTable.parentTable}}" [comboData]="tableList" boxType="select" >
                                </alb-form>
                            </div>
                            <label class="col-form-label col-lg-1 col-sm-12">
                                当前表外键
                            </label>
                            <div class="col-lg-3 col-md-9 col-sm-12">
                                <alb-form name="parentTableFk" cssClass="" [dataLiveSearch]="true" value="{{genTable.parentTableFk}}" [comboData]="columnList" boxType="select" >
                                </alb-form>
                            </div>
                        </div>
                        <div class="form-group m-form__group row">
                            <label class="col-form-label col-lg-3 col-sm-12">
                                状态 *
                            </label>
                            <div class="col-lg-4 col-md-9 col-sm-12">
                                <alb-form boxType="radio"
                                          id="status"
                                          name="status"
                                          dictCode="sys_status"
                                          value="{{genTable.status}}" cssClass="required">
                                </alb-form>
                            </div>
                        </div>
                        <div class="form-group m-form__group row">
                            <label class="col-form-label col-lg-3 col-sm-12">
                                描述
                            </label>
                            <div class="col-lg-9 col-md-9 col-sm-12">
                         <textarea class="summernote form-control" name="description"
                                   rows="5">{{genTable.description}}</textarea>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="m-section">
                    <span class="m-section__sub">
                        字段列表
                    </span>
                    <div class="m-section__content">
                        <div class="form-group m-form__group row">
                            <table id="contentTable" class="table table-striped table-bordered table-condensed">
                                <thead>
                                <tr>
                                    <th title="数据库字段名">列名</th>
                                    <th title="默认读取数据库字段备注">标题</th>
                                    <th title="描述字段">说明</th>
                                    <th title="数据库中设置的字段类型及长度">物理类型</th>
                                    <th title="实体对象的属性字段类型">Java类型</th>
                                    <th title="实体对象的属性字段（对象名.属性名|属性名2|属性名3，例如：用户user.id|name|loginName，属性名2和属性名3为Join时关联查询的字段）">
                                        Java属性名称 <i class="icon-question-sign"></i></th>
                                    <th title="是否是数据库主键">主键</th>
                                    <th title="字段是否可为空值，不可为空字段自动进行空值验证">可空</th>
                                    <th title="字段是否唯一，唯一空字段自动进行唯一性验证">唯一</th>
                                    <th title="选中后该字段被加入到insert语句里">插入</th>
                                    <th title="选中后该字段被加入到update语句里">编辑</th>
                                    <th title="选中后该字段被加入到查询列表里">列表</th>
                                    <th title="选中后该字段被加入到查询条件里">查询</th>
                                    <th title="该字段为查询字段时的查询匹配放松">查询匹配方式</th>
                                    <th title="字段在表单中显示的类型">显示表单类型</th>
                                    <th title="显示表单类型设置为“下拉框、复选框、点选框”时，需设置字典的类型">字典类型</th>
                                    <th>排序</th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr *ngFor="let column of genTable.columnFormList;index as i;" class="{{column.status=='-1'? 'error':''}}" title="{{column.status=='-1'? '已删除的列，保存之后消失！':''}}">
                                    <td nowrap>
                                        <input type="hidden" name="columnFormList[{{i}}].id"
                                               value="{{column.id}}"/>
                                        <input type="hidden" name="columnFormList[{{i}}].status"
                                               value="{{column.status}}"/>
                                        <input type="hidden" name="columnFormList[{{i}}].genTableId"
                                               value="{{column.genTableId}}"/>
                                        <input type="hidden" name="columnFormList[{{i}}].name"
                                               value="{{column.name}}"/>{{column.name}}
                                    </td>
                                    <td>
                                        <input type="text" name="columnFormList[{{i}}].title"
                                               value="{{column.title}}" maxlength="200"
                                               class="form-control required input-small"/>
                                    </td>
                                    <td>
                                        <input type="text" name="columnFormList[{{i}}].comments"
                                               value="{{column.comments}}" maxlength="200"
                                               class="form-control input-small"/>
                                    </td>
                                    <td nowrap>
                                        <input type="hidden" name="columnFormList[{{i}}].jdbcType"
                                               value="{{column.jdbcType}}"/>{{column.jdbcType}}
                                    </td>
                                    <td>
                                        <alb-form name="columnFormList[{{i}}].javaType" value="{{column.javaType}}" cssClass="required input-mini" [comboData]="javaTypeList" boxType="select"></alb-form>
                                    </td>
                                    <td>
                                        <input type="text" name="columnFormList[{{i}}].javaField"
                                               value="{{column.javaField}}" maxlength="200"
                                               class="required form-control input-small"/>
                                    </td>
                                    <td>
                                        <label class="m-checkbox">
                                            <input type="checkbox" name="columnFormList[{{i}}].isPk" value="1" checked="{{column.isPk == 1?'checked':''}}"/>
                                            <span></span>
                                        </label>

                                    </td>
                                    <td>
                                        <label class="m-checkbox">
                                            <input type="checkbox" name="columnFormList[{{i}}].isNull" value="1" checked="{{column.isNull == 1?'checked':''}}"/>
                                            <span></span>
                                        </label>

                                    </td>
                                    <td>
                                        <label class="m-checkbox">
                                            <input type="checkbox" name="columnFormList[{{i}}].isUnique" value="1" checked="{{column.isUnique == 1?'checked':''}}"/>
                                            <span></span>
                                        </label>

                                    </td>
                                    <td>
                                        <label class="m-checkbox">
                                            <input type="checkbox" name="columnFormList[{{i}}].isInsert" value="1" checked="{{column.isInsert == 1?'checked':''}}"/>
                                            <span></span>
                                        </label>

                                    </td>
                                    <td>
                                        <label class="m-checkbox">
                                            <input type="checkbox" name="columnFormList[{{i}}].isEdit" value="1" checked="{{column.isEdit == 1?'checked':''}}"/>
                                            <span></span>
                                        </label>

                                    </td>
                                    <td>
                                        <label class="m-checkbox">
                                            <input type="checkbox" name="columnFormList[{{i}}].isList" value="1" checked="{{column.isList == 1?'checked':''}}"/>
                                            <span></span>
                                        </label>

                                    </td>
                                    <td>
                                        <label class="m-checkbox">
                                            <input type="checkbox" name="columnFormList[{{i}}].isQuery" value="1" checked="{{column.isQuery == 1?'checked':''}}"/>
                                            <span></span>
                                        </label>
                                    </td>

                                    <td>
                                        <alb-form name="columnFormList[{{i}}].queryType" value="{{column.queryType}}" cssClass="required input-mini" [comboData]="queryTypeList" boxType="select" > </alb-form>
                                    </td>
                                    <td>
                                        <alb-form name="columnFormList[{{i}}].showType" value="{{column.showType}}" cssClass="required" [comboData]="showTypeList" boxType="select" > </alb-form>
                                    </td>
                                    <td>
                                        <input type="text" name="columnFormList[{{i}}].dictType"
                                               value="{{column.dictType}}" maxlength="200" class="input-xsmall form-control"/>
                                    </td>
                                    <td>
                                        <input type="text" name="columnFormList[{{i}}].sort"
                                               value="{{column.sort}}" maxlength="200"
                                               class="form-control required input-mini digits"/>
                                    </td>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>

                </div>
            </div>
            <div class="m-portlet__foot m-portlet__foot--fit">
                <div class="m-form__actions m-form__actions">
                    <div class="row">
                        <div class="col-lg-9 ml-lg-auto">
                            <button type="button" class="btn btn-success save">
                                <i class="fa fa-check"></i> 保存
                            </button>
                            <button type="button" class="btn btn-secondary" onclick="albedoForm.resetForm('#genTable-save-form')">
                                重置
                            </button>
                            <button type="button" class="btn" onclick="window.history.back()">返回</button>
                        </div>
                    </div>
                </div>
            </div>
        </form>
        <!--end::Form-->
    </div>
    <!--end::Portlet-->
</div>
